<?php
/**
 * Created by FileCsv.class.php.
 * User: wuxiang
 * Date: 2016/11/18
 * Time: 16:16
 */

namespace Common\Libiary;


class FileCsv
{
    public static function exportCsv($filename,$data)
    {
        header("Content-type:text/csv");
        header("Content-Disposition:attachment;filename=".$filename.'_'.date('YmdHi').'.csv');
        header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
        header('Expires:0');
        header('Pragma:public');
        echo $data;
    }
}